package Homework02;

import com.sun.org.apache.xerces.internal.dom.AttrNSImpl;

import java.io.*;

public class readfile02 {
    public static void main(String[] args) throws IOException {
        String filepath = "e:\\mytempt\\work.txt";
        File file = new File(filepath);
        FileInputStream is1 = new FileInputStream(file) ;
        InputStreamReader isr = new InputStreamReader(is1,"utf-8");
        BufferedReader br = new BufferedReader(isr);
        String line = "";
        int cout =0;
        while((line =br.readLine())!=null){
            cout++;
            System.out.println(cout + ". " + line);
        }
        System.out.println("文件按行读取完毕");
    }
}
